Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add license url parsing #1644

Merged
merged 16 commits into from
Dec 13, 2018
Merged

Add license url parsing #1644

merged 16 commits into from
Dec 13, 2018

Conversation

tylerdaines
Copy link
Contributor

This PR is based off #1010. It closes #484 and parses license urls from <ms:laurl> and <mspr:pro> in the DASH manifest. I believe I have addressed all the suggestions made in the original PR.

/cc @forbesjo

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@tylerdaines
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot
Copy link

CLAs look good, thanks!

@tylerdaines
Copy link
Contributor Author

Any chance I can get some feedback on this? I'm hoping this can make it in 2.5.

@ismena
Copy link
Contributor

ismena commented Nov 6, 2018

@tylerdaines Definitely! Thanks for the ping and apologies for the delay.

@TheModMaker @vaage Guys, could I ask you to take a look since you both worked on the #1010

lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Show resolved Hide resolved
@tylerdaines
Copy link
Contributor Author

@vaage I think I have addressed all your concerns and reverted my ill-advised white space changes. Anything else I need to look at?

lib/dash/content_protection.js Show resolved Hide resolved
lib/dash/content_protection.js Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
vaage
vaage previously requested changes Nov 19, 2018
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
test/dash/dash_parser_content_protection_unit.js Outdated Show resolved Hide resolved
@joeyparrish joeyparrish added the type: enhancement New feature or request label Nov 21, 2018
@tdaines
Copy link

tdaines commented Nov 29, 2018

@vaage Anything else you want me to take a second pass at?

lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
keyId: null,
schemeUri: '',
node: strToXml([
'<test xmlns:ms="urn:microsoft">',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this isn't the correct namespace URI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't find much on this but I did find this Azure Media sample page that links to this manifest which uses the same namespaces so I think it's correct:

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" 
    xmlns:cenc="urn:mpeg:cenc:2013" 
    xmlns:mspr="urn:microsoft:playready" 
    xmlns:ms="urn:microsoft" mediaPresentationDuration="PT52.208S" minBufferTime="PT3S">
    <Period>
        <AdaptationSet ...snip...>
            <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="096D74B9-362D-4110-949B-EC0F5694F750"/>
            <ContentProtection schemeIdUri="urn:uuid:9A04F079-9840-4286-AB92-E65BE0885F95" value="2.0" cenc:default_KID="096D74B9-362D-4110-949B-EC0F5694F750">
                <mspr:pro>...snip...</mspr:pro>
            </ContentProtection>
            <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" cenc:default_KID="096D74B9-362D-4110-949B-EC0F5694F750">
                <cenc:pssh>AAAAMnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABISEAltdLk2LUEQlJvsD1aU91A=</cenc:pssh>
                <ms:laurl licenseUrl="https://ampvideos.keydelivery.mediaservices.windows.net/Widevine/?kid=096d74b9-362d-4110-949b-ec0f5694f750"/>
            </ContentProtection>
...snip...

test/dash/dash_parser_content_protection_unit.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
test/dash/dash_parser_content_protection_unit.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
@tylerdaines
Copy link
Contributor Author

tylerdaines commented Dec 6, 2018

I believe I have addressed all the latest issues. Anything else that needs addressing?

lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved
lib/dash/content_protection.js Outdated Show resolved Hide resolved

records.push({
type: type,
value: new Uint8Array(recordValue),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't you just do new Uint8Array(recordData, byteOffset, byteLength)?

Copy link
Contributor Author

@tylerdaines tylerdaines Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I went back and forth on and couldn't find a better way. The issue is in the ArrayBuffer recordData, the data is all 16-bit numbers (i.e. every other byte is 0), so I went with the "cast the Uint16 numbers to Uint8 numbers" approach.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, you should convert to a string here since the data will be UTF-16, not UTF-8 like the later string conversion expects. Skipping every other byte like this only works for ASCII.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I was too focused on using the existing parseXml which was expecting UTF-8. Fixed.

}

const rootElement = shaka.util.XmlUtils.parseXml(
record.value.buffer, 'WRMHEADER');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work since it will parse from the beginning of the buffer, not the beginning of the record. You should edit the parseXml to accept a BufferSource instead and just pass record.value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer using parseXml so I didn't edit it's signature.

@tylerdaines
Copy link
Contributor Author

Think I fixed all the issues in the latest code review. Anything else?

@shaka-bot
Copy link
Collaborator

All tests passed!

@vaage vaage dismissed their stale review December 13, 2018 18:52

I can't find my pending comments and this has been in review long enough. If we find issues with it later, we can fix it ourselves.

@vaage
Copy link
Contributor

vaage commented Dec 13, 2018

The build bot says its good.

@TheModMaker it looks like you had the most substantial concerns. If you are good with this, I think it is safe to accept it and then we can address any minor issues ourselves.

@TheModMaker TheModMaker merged commit 3c8241f into shaka-project:master Dec 13, 2018
@tylerdaines
Copy link
Contributor Author

Thanks guys!

@tylerdaines tylerdaines deleted the parse-license-url branch December 13, 2018 18:59
@TheModMaker
Copy link
Contributor

FYI, I will create a follow-up to change how this works with the Player configuration. I will change it to use the manifest value as a default and use the Player configuration as an override. This means the manifest value will only be used if you don't specify a license server in the configuration. This is consistent with our other configuration settings being overrides.

@chrisfillmore
Copy link
Contributor

@tylerdaines thanks for your work on this, this will help my team too. :)

@tylerdaines
Copy link
Contributor Author

@TheModMaker I'd be happy to take that on if you haven't already started on it.

@TheModMaker
Copy link
Contributor

Thanks for the offer, but I just pushed that change.

shaka-bot pushed a commit that referenced this pull request May 2, 2019
If the application developer specifies license servers, only those
should be used.  Before this, a manifest-specified license server
for a certain key system could still be used if the application didn't
provide one.

Now, if there are _any_ license servers specified by the app, _no_
license servers will be used from the manifest.  This is important
because it allows the application a clear way to indicate which DRM
systems should be used on platforms with multiple DRM systems.

The new order of preference for drmInfo:
1. Clear Key config, used for debugging, should override everything else.
   (The application can still specify a clearkey license server.)
2. Application-configured servers, if any are present, should override
   anything from the manifest.  Nuance: if key system A is in the manifest
   and key system B is in the player config, only B will be used, not A.
3. Manifest-provided license servers are only used if nothing else is
   specified.

Introduced in #1644 to solve #484
Internal issue b/131264101
Closes #1905

Change-Id: I1a36a70044dc7bcc22681e3e4246d0a43d58e413
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parse ms:laurl and ms:pro in DASH
10 participants